/**   
 * @Title: SportteryFootballHemaiLannchCommunicater.java 
 * @Package com.esun.rabbit2.communicaters.sportteryfootball 
 * @Description: (竞彩足球发起合买接口) 
 * @author: City Jiangsy@500wan.com   
 * @date: 2011-8-22 上午11:44:01  
 * Copyright: (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.sportteryfootballshengfu;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Config;
import com.esun.config.DistributionChannels;
import com.esun.config.Key;
import com.esun.config.Language;
import com.esun.model.UserInfo;
import com.esun.network.ServerCommunicater;
import com.esun.util.HashMapUtil;
import com.esun.util.log.EDebug;

/**
 * @ClassName: SportteryFootballShengfuHemaiLannchCommunicater
 * @Description: 足球胜负发起和买接口
 * @author: Liujun liuj@500wan.com
 * @date: 2012-4-25 上午11:50:52
 * 
 */
public class SportteryFootballShengfuHemaiLannchCommunicater extends ServerCommunicater {

	private String msgServer; // 服务器信息
	private boolean isSucceed = false;

	public String getMsgServer() {
		return msgServer;
	}

	public void setMsgServer(String msgServer) {
		this.msgServer = msgServer;
	}

	public boolean isBuySucceed(int zhushu, int beishu, long allMoney, long allNum, Long buyNum, long baodiNum, int tichengNum, String codes, boolean isBaodi, String expect)
			throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {

		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		list.add(HashMapUtil.getMapItem(BussinessCode.PASER_MID, BussinessCode.MID_SPORTTERFOOTBALLSHENGFU_HEMAILAUNCHER));
		list.add(HashMapUtil.getMapItem(BussinessCode.PASER_CK, UserInfo.getUserInfo().getUserSession()));
		list.add(HashMapUtil.getMapItem(Key.KEY_CHANNEL, DistributionChannels.QUDAO));
		list.add(HashMapUtil.getMapItem(Key.KEY_LOTID, Config.SHENGFUCAI));
		list.add(HashMapUtil.getMapItem(Key.KEY_ALLMONEY, Long.toString(allMoney)));
		list.add(HashMapUtil.getMapItem(Key.KEY_BEISHU, Integer.toString(beishu)));
		list.add(HashMapUtil.getMapItem(Key.KEY_CODES, codes));
		list.add(HashMapUtil.getMapItem(Key.KEY_TITLE, Language.STR_HEMAI_TITLE));
		list.add(HashMapUtil.getMapItem(Key.KEY_ALLNUM, Long.toString(allNum)));
		list.add(HashMapUtil.getMapItem(Key.KEY_BUYNUM, Long.toString(buyNum)));
		EDebug.o(SportteryFootballShengfuHemaiLannchCommunicater.this, " step 11 ");
		list.add(HashMapUtil.getMapItem(Key.KEY_ZHUSHU, Integer.toString(zhushu)));
		if (isBaodi) {
			list.add(HashMapUtil.getMapItem(Key.KEY_ISBAODI, Config.NUM1));
			list.add(HashMapUtil.getMapItem(Key.KEY_BAODINUM, Long.toString(baodiNum)));
		} else {
			list.add(HashMapUtil.getMapItem(Key.KEY_ISBAODI, Config.NUM0));
		}
		list.add(HashMapUtil.getMapItem(Key.KEY_TICHENG, Integer.toString(tichengNum)));
		list.add(HashMapUtil.getMapItem(Key.KEY_EXPECT, expect));

		// 写入服务器返回信息
		super.getServerResponse(list, true);
		setMsgServer(super.getErrorMSG());
		if (super.getState() == 100) {
			isSucceed = true;
		} else {
			isSucceed = false;
		}
		return isSucceed;

	}
}
